package com.project.controller;

import com.project.bean.CutPageBean;
import com.project.bean.ProductBean;
import com.project.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * @Title: ProductController
 * @Package: com.project.controller
 * @Description:
 * @Author: Liang-Xie
 * @Date: 2022/6/27 - 15:59
 */
@SuppressWarnings("all")
@RestController
@RequestMapping("product")
public class ProductController {
    @Autowired
    private IProductService service;
    @RequestMapping("findByItem")
    public CutPageBean<ProductBean>findByItem(Integer pageNum, String name, LocalDate startDate, LocalDate endDate){
        return service.findByItem(pageNum,name,startDate,endDate);
    }
    @RequestMapping("fingById")
    public ProductBean findById(Integer id){
        return service.findById(id);
    }
    @RequestMapping("update")
    public String update(Integer id,Integer price){
        service.update(id,price);
        return "ok";
    }
}
